package com.atguigu.spring.aop;

import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author mi
 * @time 2021/3/14 9:17
 */
@Component //切面存在的话就会返回代理对象
public class HelloService {
	public HelloService(){
		System.out.println("HelloService组件正在创建....");
	}

	@Transactional
	public String sayHello(String name){
		String result = "你好："+name;
		System.out.println(result);
		int length = name.length();
		return result + "---" + length;
	}
}
